<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Manager extends Authenticatable
{

    //
    use SoftDeletes;

    protected $casts=[
        'wx_userinfo'=>'json'
    ];

    protected $dates=['deleted_at'];

    protected $fillable=['name','phone','password','type','company','invitation_code','parent_mid','status','wx_userinfo'];

    public function hasOrders()
    {
        return $this->hasMany(Order::class,'mid');
    }

    public function parent()
    {
        return $this->belongsTo(Manager::class,'parent_mid');
    }
}
